package com.opgea.crm.repository.security;

import java.util.List;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

import org.springframework.stereotype.Repository;

import com.opgea.crm.domain.entities.security.Resource;
@Repository
public class ResourceRepositoryImpl implements ResourceRepository{

	@PersistenceContext
	EntityManager em;
	
	@Override
	public void create(Resource resource) {
		em.persist(resource);
	}

	@Override
	public Resource find(Long id) {
		return em.find(Resource.class, id);
	}

	@Override
	public List<Resource> findAll() {
		String query = "SELECT r FROM Resource r";
		return em.createQuery(query, Resource.class).getResultList();
	}

	@Override
	public void update(Resource resource) {
	}

	@Override
	public void remove(Long id) {
	}

}
